<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="bolao" />
    <g:set var="entityName" value="${message(code: 'match.label', default: 'Match')}" />
    <title><g:message code="default.edit.label" args="[entityName]" /></title>
</head>
<body>
  <div class="body">
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${match}">
      <div class="errors">
        <g:renderErrors bean="${match}" as="list" />
      </div>
    </g:hasErrors>
    <g:form method="post" >
      <input type="hidden" name="id" value="${match?.id}" />
      <input type="hidden" name="version" value="${match?.version}" />
      <div class="dialog">
        <fieldset>
            <legend><g:message code="default.edit.label" args="[entityName]" /></legend>
            <table>
              <tbody>
                <tr class="prop">
                  <td valign="top" class="name">
                    <label for="matchNumber"><g:message code="match.matchNumber.label"/>:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:match,field:'matchNumber','errors')}">${match.matchNumber}</td>
                </tr>
                <tr class="prop">
                  <td valign="top" class="name">
                    <label for="matchDate"><g:message code="match.matchDate.label"/>:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:match,field:'matchDate','errors')}">
                    <g:formatDate date="${match.matchDate}" format="dd/MM/yyyy HH:mm"/>
                  </td>
                </tr>
                <tr class="prop">
                  <td valign="top" class="name">
                    <label for="venue"><g:message code="match.venue.label"/>:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:match,field:'venue','errors')}">
                    ${fieldValue(bean:match,field:'venue')}
                  </td>
                </tr>
                <tr>
                  <td colspan="2">
                    <table style="text-align: center" width="90%">
                      <tr>
                        <td align="right">${match?.team1?.name}</td>
                        <td class="${hasErrors(bean: match, field: 'score1', 'errors')}">
                          <g:textField size="2" maxsize="2" id="score1" name="score1" value="${fieldValue(bean: match, field: 'score1')}" />
                        </td>
                        <td>x</td>
                        <td class="${hasErrors(bean: match, field: 'score2', 'errors')}">
                          <g:textField  size="2" maxsize="2" id="score2" name="score2" value="${fieldValue(bean: match, field: 'score2')}" />
                        </td>
                        <td align="left">${match?.team2?.name}</td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </tbody>
            </table>
        </fieldset>
      </div>
      <div class="buttons">
        <span class="button"><g:actionSubmit class="save" value="${message(code:'global.update')}" action="updateScore" /></span>
      </div>
    </g:form>
  </div>
</body>
</html>
